package com.zzyl.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zzyl.base.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true) // 保证比较时包含父类字段
@ApiModel(description = "预约信息数据传输对象") // Swagger 文档描述
public class ReservationDto extends BaseDto {

    @ApiModelProperty(value = "预约人姓名", required = true)
    private String name;

    @ApiModelProperty(value = "预约人手机号", required = true)
    private String mobile;

    @ApiModelProperty(value = "预约时间", required = true)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") // 日期时间格式化
    private LocalDateTime time;

    @ApiModelProperty(value = "探访人", required = true)
    private String visitor;

    @ApiModelProperty(value = "预约类型，0：参观预约，1：探访预约", required = true)
    private Integer type;

    @ApiModelProperty(value = "预约状态，0：待报道，1：已完成，2：取消，3：过期", required = true)
    private Integer status;

    // 带主要字段的构造函数
    public ReservationDto(Long id, String name, String mobile, LocalDateTime time, 
                          String visitor, Integer type, Integer status, String remark) {
        this.setId(id);  // 从父类设置 id
        this.name = name;
        this.mobile = mobile;
        this.time = time;
        this.visitor = visitor;
        this.type = type;
        this.status = status;
        this.setRemark(remark); // 从父类设置备注
    }
}
